import { View } from "../../../../mvc/core/View";
import { LayerManager } from "../../../manager/LayerManager";
import { ObjCreate } from "../../common/ObjCreate";
import { ResFileConst } from "../../../resource/ResFileConst";
import { Dispatcher } from "../../../../mvc/core/Dispatcher";
import { DataEvent } from "../../../events/DataEvent";
import { EventName } from "../../../mvc/EventName";
import { ObjectPool } from "../../../../../com/gengine/utils/pools/ObjectPool";
import { GLoadedButton } from "../../../../../com/mui/controls/GLoadedButton";
//class ArenaCrossMatchIconView
    
    export  class ArenaCrossMatchIconView extends View
    {
        constructor()
        {
            super();
            this.layer = LayerManager.rightTopUILayer;
            this.init();
            return;
        }

        /* internal  */init(): void
        {
            this._btnArenaCrossGroupIcon = ObjCreate.createGLoadedButton(ResFileConst.GroupMatchIcon, 0, 0, 60, 50, this);
            this._btnArenaCrossGroupIcon.addEventListener(flash.events.MouseEvent.CLICK, this.onArenaCrossGroupIconClick);
            return;
        }

        /* internal  */onArenaCrossGroupIconClick(arg1: Object /* flash.events.MouseEvent */): void
        {
            Dispatcher.dispatchEvent(new DataEvent(EventName.ArenaCrossShowMainWindow));
            this.hideLightMask();
            return;
        }

        public showLightMask(): void
        {
            if (!this._lightMask) 
            {
                this._lightMask = ObjectPool.getObject(LightMask);
                this._lightMask.transform.matrix = new Object /* flash.geom.Matrix */();
                this._lightMask.x = 0;
                this._lightMask.y = 0;
                this._lightMask.scaleX = 70 / 42.5;
                this._lightMask.scaleY = 59 / 42.5;
                this.addChild(this._lightMask);
            }
            return;
        }

        public hideLightMask(): void
        {
            if (this._lightMask) 
            {
                if (this._lightMask.parent) 
                {
                    this._lightMask.parent.removeChild(this._lightMask);
                }
                this._lightMask.x = 0;
                this._lightMask.y = 0;
                this._lightMask.width = 40;
                this._lightMask.height = 40;
                ObjectPool.disposeObject(this._lightMask);
                this._lightMask = null;
            }
            return;
        }

        /* internal */ /* var */_btnArenaCrossGroupIcon: GLoadedButton;

        /* internal */ /* var */_lightMask: LightMask;
    }
